<?php include('scripts.php'); ?>
<script type="text/javascript" language="javascript">
$(function() {
    $("#passwordForm").validate({
        messages : {
            newPassword2: {
                equalTo: "Please enter the same password as above"
            }
        },
        rules : {
            "oldPassword" : {
                required : true,
                minlength : 3
            },
            "newPassword" : {
                required : true,
                minlength : 3
            },
            "newPassword2" : {
                required : true,
                minlength : 3,
                equalTo: "#newPassword"
            }
        },
        submitHandler: function(form) {
            waiting();
            form.submit();
        }
    });
    $("#securityPasswordForm").validate({
        messages : {
            newSecurityPassword2: {
                equalTo: "Please enter the same password as above"
            }
        },
        rules : {
            "oldSecurityPassword" : {
                required : true,
                minlength : 3
            },
            "newSecurityPassword" : {
                required : true,
                minlength : 3
            },
            "newSecurityPassword2" : {
                required : true,
                minlength : 3,
                equalTo: "#newSecurityPassword"
            }
        },
        submitHandler: function(form) {
            waiting();
            form.submit();
        }
    });

    /*$("#securityPasswordForm").validate({
        submitHandler: function(form) {
            waiting();
            if ($.trim($("#oldSecurityPassword").val()) == "") {
                alert("Old password cannot be blank.");
                $("#oldSecurityPassword").focus();
                return false;
            }
            if ($.trim($("#newSecurityPassword").val()) == "") {
                alert("New password cannot be blank.");
                $("#newSecurityPassword").focus();
                return false;
            }
            if ($.trim($("#newSecurityPassword2").val()) == "") {
                alert("Re-enter password cannot be blank.");
                $("#newSecurityPassword").focus();
                return false;
            }
            if ($.trim($("#newSecurityPassword").val()) != $.trim($("#newSecurityPassword2").val())) {
                alert("New password do not match.");
                $("#newSecurityPassword").val("").focus();
                $("#newSecurityPassword2").val("");
                return false;
            }
            form.submit();
        }
    });*/
});
</script>

<div style="padding: 10px; top: 30px; width: 98%">
    <?php if ($sf_flash->has('successMsg')): ?>
        <div class="ui-widget">
            <div style="margin-top: 20px; padding: 0 .7em;" class="ui-state-highlight ui-corner-all">
                <p><span style="float: left; margin-right: .3em;" class="ui-icon ui-icon-info"></span>
                <strong><?php echo $sf_flash->get('successMsg') ?></strong></p>
            </div>
        </div>
    <?php endif; ?>
    <?php if ($sf_flash->has('errorMsg')): ?>
        <div class="ui-widget">
            <div style="margin-top: 20px; padding: 0 .7em;" class="ui-state-error ui-corner-all">
                <p><span style="float: left; margin-right: .3em;" class="ui-icon ui-icon-alert"></span>
                <strong><?php echo $sf_flash->get('errorMsg') ?></strong></p>
            </div>
        </div>
    <?php endif; ?>
    <br>

    <div class="portlet">
        <div class="portlet-header"><?php echo __('Update Login Password') ?></div>
        <div class="portlet-content">
            <form action="/member/loginPassword" id="passwordForm" method="post">
                <table cellpadding="0" cellspacing="5" border="0" width="100%">
                    <tr>
                        <td>
                            <table cellpadding="0" cellspacing="5" border="0">
                                <tr>
                                    <td width="200px">
                                        <strong><?php echo __('Old Login Password'); ?></strong>
                                    </td>
                                    <td>
                                        <input name="oldPassword" type="password" id="oldPassword" tabindex="1"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <strong><?php echo __('New Login Password'); ?></strong>
                                    </td>
                                    <td>
                                        <input name="newPassword" type="password" id="newPassword" tabindex="2"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <strong><?php echo __('Re-enter Login Password'); ?></strong>
                                    </td>
                                    <td>
                                        <input name="newPassword2" type="password" id="newPassword2" tabindex="3"/>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <hr>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <button class="btnUpdate"><?php echo __('Update') ?></button>
                        </td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
    <br>
    <div class="portlet">
        <div class="portlet-header"><?php echo __('Update Security Password') ?></div>
        <div class="portlet-content">
            <form action="/member/transactionPassword" id="securityPasswordForm" method="post">
                <table cellpadding="0" cellspacing="5" border="0" width="100%">
                    <tr>
                        <td>
                            <table cellpadding="0" cellspacing="5" border="0">
                                <tr>
                                    <td width="200px">
                                        <strong><?php echo __('Old Security Password'); ?></strong>
                                    </td>
                                    <td>
                                        <input name="oldSecurityPassword" type="password" id="oldSecurityPassword" tabindex="4" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <strong><?php echo __('New Security Password'); ?></strong>
                                    </td>
                                    <td>
                                        <input name="newSecurityPassword" type="password" id="newSecurityPassword" tabindex="5" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <strong><?php echo __('Re-enter Security Password'); ?></strong>
                                    </td>
                                    <td>
                                        <input name="newSecurityPassword2" type="password" id="newSecurityPassword2" tabindex="6" />
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <hr>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <button class="btnUpdate"><?php echo __('Update') ?></button>
                        </td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
</div>